package com.tcm.order.service.impl;

import com.tcm.order.entity.Invoice;
import com.tcm.order.dao.mapper.InvoiceMapper;
import com.tcm.order.service.InvoiceService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 
 * @Description:发票服务类
 * @author biuco
 * 2020年3月10日上午9:14:53
 *
 */
@DubboService(version = "0.0.1-alpha")
public class InvoiceServiceImpl implements InvoiceService {


	private final InvoiceMapper invoiceMapper;

	@Autowired
	InvoiceServiceImpl(InvoiceMapper invoiceMapper){
		this.invoiceMapper = invoiceMapper;
	}

	@Override
	public int deleteByUserOrder(Long userId, Long orderId) {
		return invoiceMapper.deleteByUserOrder(userId, orderId);
	}

	@Override
	public int deleteLogicByUserOrder(Long userId, Long orderId) {
		return invoiceMapper.deleteLogicByUserOrder(userId, orderId);
	}

	@Override
	public int create(Invoice invoice) {
		return invoiceMapper.insert(invoice);
	}

	@Override
	public Invoice findByUserOrder(Long userId, Long orderId) {
		return invoiceMapper.findByUserOrder(userId, orderId);
	}

	@Override
	public int deleteById(Long id) {
		return invoiceMapper.deleteByKey(id);
	}

	@Override
	public int deleteLogicById(Long id) {
		return deleteLogicById(id);
	}
}
